home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / Recent1 / AmIRCFetch.lha / Fetch.amirx < prev   
Text File  |  1997-03-04  |  5KB  |  138 lines

  1. /* Fetch script for use with AmIRC 1.x */ Version='1.06'/*
  2. // Written by Deryk Robosson 11.19.96
  3. //
  4. // 11.24.96 - added .readme fetching support
  5. // 16.1.97 - added support for result codes
  6. // 4.2.97 - added path variable for ftpget and updated
  7. //          the docs
  8. //          added support for not obtaining the .readmes
  9. //          added multi site support - Requested by TheBarron
  10. // 13.2.97 - added .readme viewing support - Suggested by Gallant
  11. //           optimised the source - Suggestions made by Gallant
  12. // 4.3.97 - prettied up the display of information
  13. //
  14. // newlook@ameritech.net newlook on #amiga IRC (EfNet)
  15. */
  16. esc=d2c(27)
  17. bold=d2c(2)
  18. underline=x2c('1F')
  19.  
  20. /* this is the default site list, edit for any changes */
  21. site0 = "wuarchive.wustl.edu"
  22. site1 = "ftp.netnet.net"
  23. site2 = "ftp.uni-paderborn.de"
  24. site3 = "ftp.doc.ic.ac.uk"
  25. site4 = "ftp.ninemoons.com"
  26.  
  27. /* change this to 0 if you don't want readme files, 1 otherwise */
  28. readmes=1
  29.  
  30. /* change this to 0 if you don't want the readme files displayed after download , 1 otherwise */
  31. displayreadme=1
  32.  
  33. /* Change this to your favorite site */
  34. defaultsite=site0 /*'wuarchive.wustl.edu'*/
  35.  
  36. /* Change this to your default incoming directory */
  37. incomingdir="in:"
  38.  
  39. /* Change this to reflect the path of ftpget */
  40. path="amitcp:bin/ftpget"
  41.  
  42. /* Change this to your favorite text viewer */
  43. textviewer="sys:utilities/multiview"
  44.  
  45. /* Change this to your email address */
  46. pass="newlook@ameritech.net"
  47.  
  48. options results
  49. parse arg file" "param
  50.  
  51. if file="" then do
  52.     Call Version()
  53.     Exit
  54. end
  55. if upper(file)="VER" then do
  56.     Call Version()
  57.     Exit
  58. end
  59. if upper(file)="HELP" then do
  60.     Call Help()
  61.     Exit
  62. end
  63. if upper(file)="SITELIST" then do
  64.     Call ListSites()
  65.     Exit
  66. end
  67. if param~="" then do
  68.     select
  69.         when param=0 then defaultsite=site0
  70.         when param=1 then defaultsite=site1
  71.         when param=2 then defaultsite=site2
  72.         when param=3 then defaultsite=site3
  73.         when param=4 then defaultsite=site4
  74.         otherwise
  75.             defaultsite=site0
  76.     end
  77. end
  78.  
  79. /* prepare for the main file */
  80. remote="REMOTE /pub/aminet/"file
  81.  
  82. /* prepare for the readme file */
  83. if readmes=1 then do
  84.     file1=left(file,length(file)-3)     /* truncate the filename */
  85.     file2=file1||'readme'               /* append the readme */
  86.     remote=remote" /pub/aminet/"file2   /* append readme to remote */
  87. end
  88.  
  89. /* setup the commandline parameters */
  90. getit=path||" "||defaultsite||" "||remote||" LOCAL "||incomingdir||" USER anonymous PASS "||pass||" QUIET"
  91. ADDRESS COMMAND getit                  /* grab the file */
  92.  
  93. select      /* inform the user as to the status of the command */
  94.     when rc=0 then "echo File retrieval finished."
  95.     when rc=21 then "echo P="ESC||BOLD"«Fetch» Invalid arguments"
  96.     when rc=22 then "echo P="ESC||BOLD"«Fetch» Cannot locate the given file list."
  97.     when rc=23 then "echo P="ESC||BOLD"«Fetch» Couldn't open bsdsocket.library."
  98.     when rc=24 then "echo P="ESC||BOLD"«Fetch» Cannot allocate enough memory for the buffer."
  99.     when rc=25 then "echo P="ESC||BOLD"«Fetch» Invalid password argument."
  100.     when rc=26 then "echo P="ESC||BOLD"«Fetch» Remote site doesn't exist."
  101.     when rc=27 then "echo P="ESC||BOLD"«Fetch» Remote server not responding/unavailable."
  102.     when rc=28 then "echo P="ESC||BOLD"«Fetch» User name not accepted at remote site."
  103.     when rc=29 then "echo P="ESC||BOLD"«Fetch» Password not accepted at remote site."
  104.     when rc=30 then "echo P="ESC||BOLD"«Fetch» Account not accepted at remote site."
  105.     when rc=31 then "echo P="ESC||BOLD"«Fetch» Cannot obtain the remote file/permission denied."
  106.     when rc=32 then "echo P="ESC||BOLD"«Fetch» Cannot create the local file."
  107.     when rc=33 then "echo P="ESC||BOLD"«Fetch» Transfer aborted or Transfer error."
  108.     otherwise
  109.         "echo P="ESC||BOLD"«Fetch» An unknown error has occured."
  110. end
  111.  
  112. if readmes=1 then if displayreadme=1 then address COMMAND textviewer||" "incomingdir||substr(file2,lastpos('/',file2)+1,length(file2))
  113. EXIT
  114.  
  115. Version:
  116. "ECHO P="ESC||BOLD"«Fetch» "BOLD"Fetch.AMIRX"BOLD" Version "BOLD||VERSION||BOLD
  117. "ECHO P="ESC||BOLD"«Fetch» Read the top of Fetch.AMIRX script for history."
  118. "ECHO P="ESC||BOLD"«Fetch» "BOLD"©1996"BOLD" Deryk Robosson "BOLD"(newlook)"BOLD" - [newlook@ameritech.net]"
  119. "ECHO P="ESC||BOLD"«Fetch» "BOLD"HELP:"BOLD" /<alias> help"
  120. return
  121.  
  122. Help:
  123. "ECHO P="ESC||BOLD"«Fetch» "BOLD"Fetch.AMIRX"BOLD" Help"
  124. "ECHO P="ESC||BOLD"«Fetch» /<alias> comm/tcp/AmIRCFetch.lha 2 to get file from site #2"
  125. "ECHO P="ESC||BOLD"«Fetch» "BOLD"SITELIST - "BOLD"displays current aminet site list"
  126. "ECHO P="ESC||BOLD"«Fetch» "BOLD"VER - "BOLD"displays script version"
  127. "ECHO P="ESC||BOLD"«Fetch» "BOLD"HELP - "BOLD"displays this file"
  128. return
  129.  
  130. ListSites:
  131. "ECHO P="ESC||BOLD"«Fetch» "BOLD||UNDERLINE"SiteList"BOLD||UNDERLINE
  132. "ECHO P="ESC||BOLD"«Fetch» 0 - wuarchive.wustl.edu"
  133. "ECHO P="ESC||BOLD"«Fetch» 1 - ftp.netnet.net"
  134. "ECHO P="ESC||BOLD"«Fetch» 2 - ftp.uni-paderborn.de"
  135. "ECHO P="ESC||BOLD"«Fetch» 3 - ftp.doc.ic.ac.uk"
  136. "ECHO P="ESC||BOLD"«Fetch» 4 - ftp.ninemoons.com"
  137. return
  138.